﻿using SmallTool.BaseFile;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Diagnostics;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace SmallTool.frm
{
    public partial class frm_about : Form
    {
        public frm_about()
        {
            InitializeComponent();
        }

        private void linkLabel1_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
        {
            // 设置软件所在位置
            BaseCS.instance.UpdateSaveBCSoftPath(string.Format("{0}{1}", AppDomain.CurrentDomain.BaseDirectory, @"Soft\BComp.exe"));
            // 打开软件所在文件夹
            Process.Start(string.Format("{0}{1}", AppDomain.CurrentDomain.BaseDirectory, @"Soft"));
        }

        private void linkLabel2_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
        {
            if (!ShowChildrenForm("frm_createFileSavePath"))
            {
                frm_createFileSavePath frm = new frm_createFileSavePath();
                frm.ControlBox = false;
                frm.MdiParent = this.MdiParent;
                frm.WindowState = FormWindowState.Maximized;
                frm.Show();
            }
        }

        /// <summary>
        /// 防止打开多个子窗体
        /// </summary>
        /// <param name="p_ChildrenFormText"></param>
        /// <returns></returns>
        private bool ShowChildrenForm(string p_ChildrenFormText)
        {
            foreach (var item in this.MdiChildren)
            {
                if (item.Name == p_ChildrenFormText)
                {
                    item.Activate();
                    return true;
                }
            }
            return false;
        }
    }
}
